<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>sendMail</title>
</head>
<body>
	<h1>发送邮件</h1>
	<form>
		<div>
			<label for="ToUser">收件人</label>
			<input type="text" name="ToUser" id="ToUser">
		</div>
		<div>
			<label for="ToUser">主题</label>
			<input type="text" name="subject" id="subject">
		</div>
		<input type="button" value="发送" id="sendMail">
	</form>
</body>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
	$('#sendMail').on('click',function(){
		$.ajax({
			type:'get',
			url:'/sendmail',
			data:{
				touser:ToUser.value,
				subject:subject.value
			},
			success:function(data){
				console.log(data);
				alert('成功');
			},
			error:function(data){
				console.log(data);
			}
		})
	});
</script>
</html>